{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "0418b3f9-c280-438c-8f1b-8e1c19b39889",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ef6d53e2-9287-46b2-abef-9919124090ab",
   "metadata": {},
   "outputs": [],
   "source": [
    "random_items = np.random.randint(25, size=(10)) # 10个0~24随机整数\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "c0fe4c4e-83e7-41b0-887f-935bd333f159",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([10, 19, 13, 16, 12, 16, 14,  1, 15, 16])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "random_items"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "4d4bb30a-72c5-49c9-bc5e-f2c614c85ab6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    10\n",
       "1    19\n",
       "2    13\n",
       "3    16\n",
       "4    12\n",
       "5    16\n",
       "6    14\n",
       "7     1\n",
       "8    15\n",
       "9    16\n",
       "dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "series_data = pd.Series(random_items)\n",
    "series_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "2ffb4908-4f55-4313-8952-437d9605194d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "series_data[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "4ceff758-d463-4a3c-84cf-a9175595b452",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "series_data[9]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "e8fe7a25-f5ed-434d-be8c-434e483bbaa9",
   "metadata": {},
   "outputs": [],
   "source": [
    "letter_indexs = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "9dee019d-f8d9-40f1-994e-5d4f0c9cac35",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    10\n",
       "b    19\n",
       "c    13\n",
       "d    16\n",
       "e    12\n",
       "f    16\n",
       "g    14\n",
       "h     1\n",
       "i    15\n",
       "j    16\n",
       "dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_series_data = pd.Series(random_items, index = letter_indexs)\n",
    "new_series_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6287b636-7b92-4f0b-ab22-4f944d93c2ba",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_series_data['j']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "d76a949d-38aa-4e3b-a635-76477720be9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "data_dict = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5}\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "6fd395e7-500d-4d38-8e80-2c7a7511a309",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "e    5\n",
       "dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_series = pd.Series(data_dict)\n",
    "dict_series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "d7828a6a-0e0b-42ab-a545-88820396f172",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "e    5\n",
       "Name: series_name, dtype: int64"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_series = pd.Series(data_dict, name='series_name')\n",
    "dict_series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "745a174e-97c6-47a1-936e-10273b13d3ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "e    5\n",
       "Name: new_name, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_series = dict_series.rename('new_name')\n",
    "dict_series"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "30a8fff5-9821-4828-a334-75563db7cfaa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.0"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_series.median()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "38699c45-4c33-4840-85b1-98253ea62e51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "d    4\n",
       "e    5\n",
       "Name: new_name, dtype: int64"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_series[dict_series > dict_series.median()]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "81cbab48-77c7-40da-bd0a-2cf171ddcd73",
   "metadata": {},
   "outputs": [],
   "source": [
    "d = {\n",
    "    'one': [1, 2, 3, 4],\n",
    "    'two': [4, 3, 2, 1]\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "4b3a2434-76e2-4533-b56c-2054f3e3d90a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "0    1    4\n",
       "1    2    3\n",
       "2    3    2\n",
       "3    4    1"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_df = pd.DataFrame(d)\n",
    "dict_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "e3ad2167-a0ba-494c-a815-4ce8f125e3b5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    4\n",
       "1    3\n",
       "2    2\n",
       "3    1\n",
       "Name: two, dtype: int64"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_df['two']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "cbe60a07-c320-4d4d-aa86-55e461e6142c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(dict_df['one']) # pandas.core.series.Series\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "546bebdf-8c5f-43e5-9f4b-86b65f543f29",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(4, 2)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict_df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "37bc0ccf-74d9-40fd-bf48-3d713c3ee848",
   "metadata": {},
   "outputs": [],
   "source": [
    "d_data = {\n",
    "    'one': pd.Series([1, 2, 3], name='col_one', index=['a', 'b', 'c']),\n",
    "    'two': pd.Series([1, 2, 3, 4], name='col_two', index=['a', 'b', 'c', 'd'])\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "531675c3-5719-427f-a5e5-92a51af30392",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame(d_data)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "409fabbe-e4a4-495f-a3ba-86de0820c468",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "a  1.0    1\n",
       "b  2.0    2\n",
       "c  3.0    3\n",
       "d  NaN    4"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "7bc5fe6e-8c88-42ed-bf3d-dc651d5ceb24",
   "metadata": {},
   "outputs": [],
   "source": [
    "new_df = df.reset_index()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "be294f60-346b-4aca-87f1-80eefdcdbbdb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>index</th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>a</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>b</td>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>c</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>d</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  index  one  two\n",
       "0     a  1.0    1\n",
       "1     b  2.0    2\n",
       "2     c  3.0    3\n",
       "3     d  NaN    4"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "b5c088dc-7ba0-4c2e-bfe8-f9c768148633",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "0  1.0    1\n",
       "1  2.0    2\n",
       "2  3.0    3\n",
       "3  NaN    4"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "new_df = df.reset_index(drop = True)\n",
    "new_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c05586a6-4bf5-414d-b577-4b864b00feaa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "a  1.0    1\n",
       "b  2.0    2\n",
       "c  3.0    3\n",
       "d  NaN    4"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3f8d85a4-1712-4a22-8d5d-86d2052f20cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>one</th>\n",
       "      <th>two</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2.0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   one  two\n",
       "0  1.0    1\n",
       "1  2.0    2\n",
       "2  3.0    3\n",
       "3  NaN    4"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.reset_index(drop = True, inplace = True)\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "c21105db-47cd-4871-ba81-a66aea445c17",
   "metadata": {},
   "outputs": [],
   "source": [
    "csv_data_path = 'https://raw.githubusercontent.com/turingplanet/pandas-intro/main/public-datasets/country_info.csv'\n",
    "country_info = pd.read_csv(csv_data_path)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "031ae8f8-957c-4c66-8293-ea9e688866e4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>West Bank</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>Western Sahara</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Country                               Region  Population  \\\n",
       "0       Afghanistan         ASIA (EX. NEAR EAST)             31056997   \n",
       "1           Albania   EASTERN EUROPE                          3581655   \n",
       "2           Algeria   NORTHERN AFRICA                        32930091   \n",
       "3    American Samoa   OCEANIA                                   57794   \n",
       "4           Andorra   WESTERN EUROPE                            71201   \n",
       "..               ...                                  ...         ...   \n",
       "222       West Bank   NEAR EAST                               2460492   \n",
       "223  Western Sahara   NORTHERN AFRICA                          273008   \n",
       "224           Yemen   NEAR EAST                              21456188   \n",
       "225          Zambia   SUB-SAHARAN AFRICA                     11502010   \n",
       "226        Zimbabwe   SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "     Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "0            647500                       48,0                         0,00   \n",
       "1             28748                      124,6                         1,26   \n",
       "2           2381740                       13,8                         0,04   \n",
       "3               199                      290,4                        58,29   \n",
       "4               468                      152,1                         0,00   \n",
       "..              ...                        ...                          ...   \n",
       "222            5860                      419,9                         0,00   \n",
       "223          266000                        1,0                         0,42   \n",
       "224          527970                       40,6                         0,36   \n",
       "225          752614                       15,3                         0,00   \n",
       "226          390580                       31,3                         0,00   \n",
       "\n",
       "    Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "0           23,06                             163,07               700.0   \n",
       "1           -4,93                              21,52              4500.0   \n",
       "2           -0,39                                 31              6000.0   \n",
       "3          -20,71                               9,27              8000.0   \n",
       "4             6,6                               4,05             19000.0   \n",
       "..            ...                                ...                 ...   \n",
       "222          2,98                              19,62               800.0   \n",
       "223           NaN                                NaN                 NaN   \n",
       "224             0                               61,5               800.0   \n",
       "225             0                              88,29               800.0   \n",
       "226             0                              67,69              1900.0   \n",
       "\n",
       "    Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "0           36,0               3,2      12,13      0,22     87,65       1   \n",
       "1           86,5              71,2      21,09      4,42     74,49       3   \n",
       "2           70,0              78,1       3,22      0,25     96,53       1   \n",
       "3           97,0             259,5         10        15        75       2   \n",
       "4          100,0             497,2       2,22         0     97,78       3   \n",
       "..           ...               ...        ...       ...       ...     ...   \n",
       "222          NaN             145,2       16,9     18,97     64,13       3   \n",
       "223          NaN               NaN       0,02         0     99,98       1   \n",
       "224         50,2              37,2       2,78      0,24     96,98       1   \n",
       "225         80,6               8,2       7,08      0,03      92,9       2   \n",
       "226         90,7              26,8       8,32      0,34     91,34       2   \n",
       "\n",
       "    Birthrate Deathrate Agriculture Industry Service  \n",
       "0        46,6     20,34        0,38     0,24    0,38  \n",
       "1       15,11      5,22       0,232    0,188   0,579  \n",
       "2       17,14      4,61       0,101      0,6   0,298  \n",
       "3       22,46      3,27         NaN      NaN     NaN  \n",
       "4        8,71      6,25         NaN      NaN     NaN  \n",
       "..        ...       ...         ...      ...     ...  \n",
       "222     31,67      3,92        0,09     0,28    0,63  \n",
       "223       NaN       NaN         NaN      NaN     0,4  \n",
       "224     42,89       8,3       0,135    0,472   0,393  \n",
       "225        41     19,93        0,22     0,29   0,489  \n",
       "226     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 20 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "89b4c93f-4b0d-4508-8388-f2ac9d40aaad",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(227, 20)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "54ab326e-3b90-4f61-809a-25b6badd008b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Country', 'Region', 'Population', 'Area (sq. mi.)',\n",
       "       'Pop. Density (per sq. mi.)', 'Coastline (coast/area ratio)',\n",
       "       'Net migration', 'Infant mortality (per 1000 births)',\n",
       "       'GDP ($ per capita)', 'Literacy (%)', 'Phones (per 1000)', 'Arable (%)',\n",
       "       'Crops (%)', 'Other (%)', 'Climate', 'Birthrate', 'Deathrate',\n",
       "       'Agriculture', 'Industry', 'Service'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "3209ec4e-fbf9-4cc9-81c3-501b5760cfa2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Country                               Region  Population  \\\n",
       "0     Afghanistan         ASIA (EX. NEAR EAST)             31056997   \n",
       "1         Albania   EASTERN EUROPE                          3581655   \n",
       "2         Algeria   NORTHERN AFRICA                        32930091   \n",
       "3  American Samoa   OCEANIA                                   57794   \n",
       "4         Andorra   WESTERN EUROPE                            71201   \n",
       "\n",
       "   Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "0          647500                       48,0                         0,00   \n",
       "1           28748                      124,6                         1,26   \n",
       "2         2381740                       13,8                         0,04   \n",
       "3             199                      290,4                        58,29   \n",
       "4             468                      152,1                         0,00   \n",
       "\n",
       "  Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "0         23,06                             163,07               700.0   \n",
       "1         -4,93                              21,52              4500.0   \n",
       "2         -0,39                                 31              6000.0   \n",
       "3        -20,71                               9,27              8000.0   \n",
       "4           6,6                               4,05             19000.0   \n",
       "\n",
       "  Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "0         36,0               3,2      12,13      0,22     87,65       1   \n",
       "1         86,5              71,2      21,09      4,42     74,49       3   \n",
       "2         70,0              78,1       3,22      0,25     96,53       1   \n",
       "3         97,0             259,5         10        15        75       2   \n",
       "4        100,0             497,2       2,22         0     97,78       3   \n",
       "\n",
       "  Birthrate Deathrate Agriculture Industry Service  \n",
       "0      46,6     20,34        0,38     0,24    0,38  \n",
       "1     15,11      5,22       0,232    0,188   0,579  \n",
       "2     17,14      4,61       0,101      0,6   0,298  \n",
       "3     22,46      3,27         NaN      NaN     NaN  \n",
       "4      8,71      6,25         NaN      NaN     NaN  "
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "fe10d941-0da8-4b92-b743-7cc2e87cf192",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0            ASIA (EX. NEAR EAST)         \n",
       "1      EASTERN EUROPE                     \n",
       "2      NORTHERN AFRICA                    \n",
       "3      OCEANIA                            \n",
       "4      WESTERN EUROPE                     \n",
       "                      ...                 \n",
       "222    NEAR EAST                          \n",
       "223    NORTHERN AFRICA                    \n",
       "224    NEAR EAST                          \n",
       "225    SUB-SAHARAN AFRICA                 \n",
       "226    SUB-SAHARAN AFRICA                 \n",
       "Name: Region, Length: 227, dtype: object"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info['Region']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "650d46c5-9a6e-4a08-ab61-82c69a6f5932",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0            ASIA (EX. NEAR EAST)         \n",
       "1      EASTERN EUROPE                     \n",
       "2      NORTHERN AFRICA                    \n",
       "3      OCEANIA                            \n",
       "4      WESTERN EUROPE                     \n",
       "                      ...                 \n",
       "222    NEAR EAST                          \n",
       "223    NORTHERN AFRICA                    \n",
       "224    NEAR EAST                          \n",
       "225    SUB-SAHARAN AFRICA                 \n",
       "226    SUB-SAHARAN AFRICA                 \n",
       "Name: Region, Length: 227, dtype: object"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.Region"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "f038d956-4579-4ace-aff5-0518837635ff",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>West Bank</td>\n",
       "      <td>NEAR EAST</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>Western Sahara</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>NEAR EAST</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             Country                               Region\n",
       "0       Afghanistan         ASIA (EX. NEAR EAST)         \n",
       "1           Albania   EASTERN EUROPE                     \n",
       "2           Algeria   NORTHERN AFRICA                    \n",
       "3    American Samoa   OCEANIA                            \n",
       "4           Andorra   WESTERN EUROPE                     \n",
       "..               ...                                  ...\n",
       "222       West Bank   NEAR EAST                          \n",
       "223  Western Sahara   NORTHERN AFRICA                    \n",
       "224           Yemen   NEAR EAST                          \n",
       "225          Zambia   SUB-SAHARAN AFRICA                 \n",
       "226        Zimbabwe   SUB-SAHARAN AFRICA                 \n",
       "\n",
       "[227 rows x 2 columns]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info[['Country', 'Region']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "e24f86be-465c-483c-9999-c1d28c387d7e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country                                                           Israel \n",
       "Region                                NEAR EAST                          \n",
       "Population                                                        6352117\n",
       "Area (sq. mi.)                                                      20770\n",
       "Pop. Density (per sq. mi.)                                          305,8\n",
       "Coastline (coast/area ratio)                                         1,31\n",
       "Net migration                                                        0,68\n",
       "Infant mortality (per 1000 births)                                   7,03\n",
       "GDP ($ per capita)                                                  19800\n",
       "Literacy (%)                                                         95,4\n",
       "Phones (per 1000)                                                   462,3\n",
       "Arable (%)                                                          16,39\n",
       "Crops (%)                                                            4,17\n",
       "Other (%)                                                           79,44\n",
       "Climate                                                                 3\n",
       "Birthrate                                                           17,97\n",
       "Deathrate                                                            6,18\n",
       "Agriculture                                                         0,026\n",
       "Industry                                                            0,317\n",
       "Service                                                             0,657\n",
       "Name: 100, dtype: object"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.iloc[100]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "528bef33-9dbd-4f56-8fa0-6ed5cc4ef143",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Country                               Region  Population  \\\n",
       "2         Algeria   NORTHERN AFRICA                        32930091   \n",
       "3  American Samoa   OCEANIA                                   57794   \n",
       "\n",
       "   Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "2         2381740                       13,8                         0,04   \n",
       "3             199                      290,4                        58,29   \n",
       "\n",
       "  Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "2         -0,39                                 31              6000.0   \n",
       "3        -20,71                               9,27              8000.0   \n",
       "\n",
       "  Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "2         70,0              78,1       3,22      0,25     96,53       1   \n",
       "3         97,0             259,5         10        15        75       2   \n",
       "\n",
       "  Birthrate Deathrate Agriculture Industry Service  \n",
       "2     17,14      4,61       0,101      0,6   0,298  \n",
       "3     22,46      3,27         NaN      NaN     NaN  "
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.iloc[[2, 3]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "b7554667-0b24-4ef7-a322-a3a860202d3c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>2381740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>199</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Country  Area (sq. mi.)\n",
       "2         Algeria          2381740\n",
       "3  American Samoa              199"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.iloc[[2, 3], [0, 3]]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "5e3b2b39-0cd6-4830-b2fd-354bef1e71ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "country_info['Country'] = country_info['Country'].str.strip() # 把Country列中开头和尾部的空格先去掉"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "8eed6dea-1a0f-4306-8a01-f56bdadf8731",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>American Samoa</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Western Sahara</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yemen</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                             Region  Population  \\\n",
       "Country                                                           \n",
       "Afghanistan           ASIA (EX. NEAR EAST)             31056997   \n",
       "Albania         EASTERN EUROPE                          3581655   \n",
       "Algeria         NORTHERN AFRICA                        32930091   \n",
       "American Samoa  OCEANIA                                   57794   \n",
       "Andorra         WESTERN EUROPE                            71201   \n",
       "...                                             ...         ...   \n",
       "West Bank       NEAR EAST                               2460492   \n",
       "Western Sahara  NORTHERN AFRICA                          273008   \n",
       "Yemen           NEAR EAST                              21456188   \n",
       "Zambia          SUB-SAHARAN AFRICA                     11502010   \n",
       "Zimbabwe        SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "                Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                     \n",
       "Afghanistan             647500                       48,0   \n",
       "Albania                  28748                      124,6   \n",
       "Algeria                2381740                       13,8   \n",
       "American Samoa             199                      290,4   \n",
       "Andorra                    468                      152,1   \n",
       "...                        ...                        ...   \n",
       "West Bank                 5860                      419,9   \n",
       "Western Sahara          266000                        1,0   \n",
       "Yemen                   527970                       40,6   \n",
       "Zambia                  752614                       15,3   \n",
       "Zimbabwe                390580                       31,3   \n",
       "\n",
       "               Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                     \n",
       "Afghanistan                            0,00         23,06   \n",
       "Albania                                1,26         -4,93   \n",
       "Algeria                                0,04         -0,39   \n",
       "American Samoa                        58,29        -20,71   \n",
       "Andorra                                0,00           6,6   \n",
       "...                                     ...           ...   \n",
       "West Bank                              0,00          2,98   \n",
       "Western Sahara                         0,42           NaN   \n",
       "Yemen                                  0,36             0   \n",
       "Zambia                                 0,00             0   \n",
       "Zimbabwe                               0,00             0   \n",
       "\n",
       "               Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                 \n",
       "Afghanistan                                163,07               700.0   \n",
       "Albania                                     21,52              4500.0   \n",
       "Algeria                                        31              6000.0   \n",
       "American Samoa                               9,27              8000.0   \n",
       "Andorra                                      4,05             19000.0   \n",
       "...                                           ...                 ...   \n",
       "West Bank                                   19,62               800.0   \n",
       "Western Sahara                                NaN                 NaN   \n",
       "Yemen                                        61,5               800.0   \n",
       "Zambia                                      88,29               800.0   \n",
       "Zimbabwe                                    67,69              1900.0   \n",
       "\n",
       "               Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%)  \\\n",
       "Country                                                                        \n",
       "Afghanistan            36,0               3,2      12,13      0,22     87,65   \n",
       "Albania                86,5              71,2      21,09      4,42     74,49   \n",
       "Algeria                70,0              78,1       3,22      0,25     96,53   \n",
       "American Samoa         97,0             259,5         10        15        75   \n",
       "Andorra               100,0             497,2       2,22         0     97,78   \n",
       "...                     ...               ...        ...       ...       ...   \n",
       "West Bank               NaN             145,2       16,9     18,97     64,13   \n",
       "Western Sahara          NaN               NaN       0,02         0     99,98   \n",
       "Yemen                  50,2              37,2       2,78      0,24     96,98   \n",
       "Zambia                 80,6               8,2       7,08      0,03      92,9   \n",
       "Zimbabwe               90,7              26,8       8,32      0,34     91,34   \n",
       "\n",
       "               Climate Birthrate Deathrate Agriculture Industry Service  \n",
       "Country                                                                  \n",
       "Afghanistan          1      46,6     20,34        0,38     0,24    0,38  \n",
       "Albania              3     15,11      5,22       0,232    0,188   0,579  \n",
       "Algeria              1     17,14      4,61       0,101      0,6   0,298  \n",
       "American Samoa       2     22,46      3,27         NaN      NaN     NaN  \n",
       "Andorra              3      8,71      6,25         NaN      NaN     NaN  \n",
       "...                ...       ...       ...         ...      ...     ...  \n",
       "West Bank            3     31,67      3,92        0,09     0,28    0,63  \n",
       "Western Sahara       1       NaN       NaN         NaN      NaN     0,4  \n",
       "Yemen                1     42,89       8,3       0,135    0,472   0,393  \n",
       "Zambia               2        41     19,93        0,22     0,29   0,489  \n",
       "Zimbabwe             2     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 19 columns]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.set_index(['Country'], drop = True, inplace = True)\n",
    "country_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "3df6c2df-5405-4fa7-a88f-bcc98cdd6b6a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Region                                ASIA (EX. NEAR EAST)         \n",
       "Population                                               1313973713\n",
       "Area (sq. mi.)                                              9596960\n",
       "Pop. Density (per sq. mi.)                                    136,9\n",
       "Coastline (coast/area ratio)                                   0,15\n",
       "Net migration                                                  -0,4\n",
       "Infant mortality (per 1000 births)                            24,18\n",
       "GDP ($ per capita)                                             5000\n",
       "Literacy (%)                                                   90,9\n",
       "Phones (per 1000)                                             266,7\n",
       "Arable (%)                                                     15,4\n",
       "Crops (%)                                                      1,25\n",
       "Other (%)                                                     83,35\n",
       "Climate                                                         1,5\n",
       "Birthrate                                                     13,25\n",
       "Deathrate                                                      6,97\n",
       "Agriculture                                                   0,125\n",
       "Industry                                                      0,473\n",
       "Service                                                       0,403\n",
       "Name: China, dtype: object"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc['China'] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "fc61a567-560c-4742-95e8-92d715842054",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>China</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>1313973713</td>\n",
       "      <td>9596960</td>\n",
       "      <td>136,9</td>\n",
       "      <td>0,15</td>\n",
       "      <td>-0,4</td>\n",
       "      <td>24,18</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>90,9</td>\n",
       "      <td>266,7</td>\n",
       "      <td>15,4</td>\n",
       "      <td>1,25</td>\n",
       "      <td>83,35</td>\n",
       "      <td>1,5</td>\n",
       "      <td>13,25</td>\n",
       "      <td>6,97</td>\n",
       "      <td>0,125</td>\n",
       "      <td>0,473</td>\n",
       "      <td>0,403</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Japan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>127463611</td>\n",
       "      <td>377835</td>\n",
       "      <td>337,4</td>\n",
       "      <td>7,87</td>\n",
       "      <td>0</td>\n",
       "      <td>3,26</td>\n",
       "      <td>28200.0</td>\n",
       "      <td>99,0</td>\n",
       "      <td>461,2</td>\n",
       "      <td>12,19</td>\n",
       "      <td>0,96</td>\n",
       "      <td>86,85</td>\n",
       "      <td>3</td>\n",
       "      <td>9,37</td>\n",
       "      <td>9,16</td>\n",
       "      <td>0,017</td>\n",
       "      <td>0,258</td>\n",
       "      <td>0,725</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                Region  Population  Area (sq. mi.)  \\\n",
       "Country                                                              \n",
       "China    ASIA (EX. NEAR EAST)           1313973713         9596960   \n",
       "Japan    ASIA (EX. NEAR EAST)            127463611          377835   \n",
       "\n",
       "        Pop. Density (per sq. mi.) Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                                         \n",
       "China                        136,9                         0,15          -0,4   \n",
       "Japan                        337,4                         7,87             0   \n",
       "\n",
       "        Infant mortality (per 1000 births)  GDP ($ per capita) Literacy (%)  \\\n",
       "Country                                                                       \n",
       "China                                24,18              5000.0         90,9   \n",
       "Japan                                 3,26             28200.0         99,0   \n",
       "\n",
       "        Phones (per 1000) Arable (%) Crops (%) Other (%) Climate Birthrate  \\\n",
       "Country                                                                      \n",
       "China               266,7       15,4      1,25     83,35     1,5     13,25   \n",
       "Japan               461,2      12,19      0,96     86,85       3      9,37   \n",
       "\n",
       "        Deathrate Agriculture Industry Service  \n",
       "Country                                         \n",
       "China        6,97       0,125    0,473   0,403  \n",
       "Japan        9,16       0,017    0,258   0,725  "
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[['China', 'Japan']] # 通过inner list获取中国和日本的数据\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "188acc91-1971-4596-bcb4-1b46aaddf74c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>China</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>1313973713</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Japan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>127463611</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                Region  Population\n",
       "Country                                           \n",
       "China    ASIA (EX. NEAR EAST)           1313973713\n",
       "Japan    ASIA (EX. NEAR EAST)            127463611"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[['China', 'Japan'], ['Region', 'Population']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "23ba6ca7-abc7-46d7-a65c-ddb6ec7f3add",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>China</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>1313973713</td>\n",
       "      <td>9596960</td>\n",
       "      <td>136,9</td>\n",
       "      <td>0,15</td>\n",
       "      <td>-0,4</td>\n",
       "      <td>24,18</td>\n",
       "      <td>5000.0</td>\n",
       "      <td>90,9</td>\n",
       "      <td>266,7</td>\n",
       "      <td>15,4</td>\n",
       "      <td>1,25</td>\n",
       "      <td>83,35</td>\n",
       "      <td>1,5</td>\n",
       "      <td>13,25</td>\n",
       "      <td>6,97</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Colombia</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>43593035</td>\n",
       "      <td>1138910</td>\n",
       "      <td>38,3</td>\n",
       "      <td>0,28</td>\n",
       "      <td>-0,31</td>\n",
       "      <td>20,97</td>\n",
       "      <td>6300.0</td>\n",
       "      <td>92,5</td>\n",
       "      <td>176,2</td>\n",
       "      <td>2,42</td>\n",
       "      <td>1,67</td>\n",
       "      <td>95,91</td>\n",
       "      <td>2</td>\n",
       "      <td>20,48</td>\n",
       "      <td>5,58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Comoros</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>690948</td>\n",
       "      <td>2170</td>\n",
       "      <td>318,4</td>\n",
       "      <td>15,67</td>\n",
       "      <td>0</td>\n",
       "      <td>74,93</td>\n",
       "      <td>700.0</td>\n",
       "      <td>56,5</td>\n",
       "      <td>24,5</td>\n",
       "      <td>35,87</td>\n",
       "      <td>23,32</td>\n",
       "      <td>40,81</td>\n",
       "      <td>2</td>\n",
       "      <td>36,93</td>\n",
       "      <td>8,2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Congo, Dem. Rep.</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>62660551</td>\n",
       "      <td>2345410</td>\n",
       "      <td>26,7</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>94,69</td>\n",
       "      <td>700.0</td>\n",
       "      <td>65,5</td>\n",
       "      <td>0,2</td>\n",
       "      <td>2,96</td>\n",
       "      <td>0,52</td>\n",
       "      <td>96,52</td>\n",
       "      <td>2</td>\n",
       "      <td>43,69</td>\n",
       "      <td>13,27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Congo, Repub. of the</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>3702314</td>\n",
       "      <td>342000</td>\n",
       "      <td>10,8</td>\n",
       "      <td>0,05</td>\n",
       "      <td>-0,17</td>\n",
       "      <td>93,86</td>\n",
       "      <td>700.0</td>\n",
       "      <td>83,8</td>\n",
       "      <td>3,7</td>\n",
       "      <td>0,51</td>\n",
       "      <td>0,13</td>\n",
       "      <td>99,36</td>\n",
       "      <td>2</td>\n",
       "      <td>42,57</td>\n",
       "      <td>12,93</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Isle of Man</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>75441</td>\n",
       "      <td>572</td>\n",
       "      <td>131,9</td>\n",
       "      <td>27,97</td>\n",
       "      <td>5,36</td>\n",
       "      <td>5,93</td>\n",
       "      <td>21000.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>676,0</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>91</td>\n",
       "      <td>3</td>\n",
       "      <td>11,05</td>\n",
       "      <td>11,19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Israel</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>6352117</td>\n",
       "      <td>20770</td>\n",
       "      <td>305,8</td>\n",
       "      <td>1,31</td>\n",
       "      <td>0,68</td>\n",
       "      <td>7,03</td>\n",
       "      <td>19800.0</td>\n",
       "      <td>95,4</td>\n",
       "      <td>462,3</td>\n",
       "      <td>16,39</td>\n",
       "      <td>4,17</td>\n",
       "      <td>79,44</td>\n",
       "      <td>3</td>\n",
       "      <td>17,97</td>\n",
       "      <td>6,18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Italy</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>58133509</td>\n",
       "      <td>301230</td>\n",
       "      <td>193,0</td>\n",
       "      <td>2,52</td>\n",
       "      <td>2,07</td>\n",
       "      <td>5,94</td>\n",
       "      <td>26700.0</td>\n",
       "      <td>98,6</td>\n",
       "      <td>430,9</td>\n",
       "      <td>27,79</td>\n",
       "      <td>9,53</td>\n",
       "      <td>62,68</td>\n",
       "      <td>NaN</td>\n",
       "      <td>8,72</td>\n",
       "      <td>10,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Jamaica</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>2758124</td>\n",
       "      <td>10991</td>\n",
       "      <td>250,9</td>\n",
       "      <td>9,30</td>\n",
       "      <td>-4,92</td>\n",
       "      <td>12,36</td>\n",
       "      <td>3900.0</td>\n",
       "      <td>87,9</td>\n",
       "      <td>124,0</td>\n",
       "      <td>16,07</td>\n",
       "      <td>10,16</td>\n",
       "      <td>73,77</td>\n",
       "      <td>2</td>\n",
       "      <td>20,82</td>\n",
       "      <td>6,52</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Japan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>127463611</td>\n",
       "      <td>377835</td>\n",
       "      <td>337,4</td>\n",
       "      <td>7,87</td>\n",
       "      <td>0</td>\n",
       "      <td>3,26</td>\n",
       "      <td>28200.0</td>\n",
       "      <td>99,0</td>\n",
       "      <td>461,2</td>\n",
       "      <td>12,19</td>\n",
       "      <td>0,96</td>\n",
       "      <td>86,85</td>\n",
       "      <td>3</td>\n",
       "      <td>9,37</td>\n",
       "      <td>9,16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>62 rows × 16 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                   Region  Population  \\\n",
       "Country                                                                 \n",
       "China                       ASIA (EX. NEAR EAST)           1313973713   \n",
       "Colombia                          LATIN AMER. & CARIB        43593035   \n",
       "Comoros               SUB-SAHARAN AFRICA                       690948   \n",
       "Congo, Dem. Rep.      SUB-SAHARAN AFRICA                     62660551   \n",
       "Congo, Repub. of the  SUB-SAHARAN AFRICA                      3702314   \n",
       "...                                                   ...         ...   \n",
       "Isle of Man           WESTERN EUROPE                            75441   \n",
       "Israel                NEAR EAST                               6352117   \n",
       "Italy                 WESTERN EUROPE                         58133509   \n",
       "Jamaica                           LATIN AMER. & CARIB         2758124   \n",
       "Japan                       ASIA (EX. NEAR EAST)            127463611   \n",
       "\n",
       "                      Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                           \n",
       "China                        9596960                      136,9   \n",
       "Colombia                     1138910                       38,3   \n",
       "Comoros                         2170                      318,4   \n",
       "Congo, Dem. Rep.             2345410                       26,7   \n",
       "Congo, Repub. of the          342000                       10,8   \n",
       "...                              ...                        ...   \n",
       "Isle of Man                      572                      131,9   \n",
       "Israel                         20770                      305,8   \n",
       "Italy                         301230                      193,0   \n",
       "Jamaica                        10991                      250,9   \n",
       "Japan                         377835                      337,4   \n",
       "\n",
       "                     Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                           \n",
       "China                                        0,15          -0,4   \n",
       "Colombia                                     0,28         -0,31   \n",
       "Comoros                                     15,67             0   \n",
       "Congo, Dem. Rep.                             0,00             0   \n",
       "Congo, Repub. of the                         0,05         -0,17   \n",
       "...                                           ...           ...   \n",
       "Isle of Man                                 27,97          5,36   \n",
       "Israel                                       1,31          0,68   \n",
       "Italy                                        2,52          2,07   \n",
       "Jamaica                                      9,30         -4,92   \n",
       "Japan                                        7,87             0   \n",
       "\n",
       "                     Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                       \n",
       "China                                             24,18              5000.0   \n",
       "Colombia                                          20,97              6300.0   \n",
       "Comoros                                           74,93               700.0   \n",
       "Congo, Dem. Rep.                                  94,69               700.0   \n",
       "Congo, Repub. of the                              93,86               700.0   \n",
       "...                                                 ...                 ...   \n",
       "Isle of Man                                        5,93             21000.0   \n",
       "Israel                                             7,03             19800.0   \n",
       "Italy                                              5,94             26700.0   \n",
       "Jamaica                                           12,36              3900.0   \n",
       "Japan                                              3,26             28200.0   \n",
       "\n",
       "                     Literacy (%) Phones (per 1000) Arable (%) Crops (%)  \\\n",
       "Country                                                                    \n",
       "China                        90,9             266,7       15,4      1,25   \n",
       "Colombia                     92,5             176,2       2,42      1,67   \n",
       "Comoros                      56,5              24,5      35,87     23,32   \n",
       "Congo, Dem. Rep.             65,5               0,2       2,96      0,52   \n",
       "Congo, Repub. of the         83,8               3,7       0,51      0,13   \n",
       "...                           ...               ...        ...       ...   \n",
       "Isle of Man                   NaN             676,0          9         0   \n",
       "Israel                       95,4             462,3      16,39      4,17   \n",
       "Italy                        98,6             430,9      27,79      9,53   \n",
       "Jamaica                      87,9             124,0      16,07     10,16   \n",
       "Japan                        99,0             461,2      12,19      0,96   \n",
       "\n",
       "                     Other (%) Climate Birthrate Deathrate  \n",
       "Country                                                     \n",
       "China                    83,35     1,5     13,25      6,97  \n",
       "Colombia                 95,91       2     20,48      5,58  \n",
       "Comoros                  40,81       2     36,93       8,2  \n",
       "Congo, Dem. Rep.         96,52       2     43,69     13,27  \n",
       "Congo, Repub. of the     99,36       2     42,57     12,93  \n",
       "...                        ...     ...       ...       ...  \n",
       "Isle of Man                 91       3     11,05     11,19  \n",
       "Israel                   79,44       3     17,97      6,18  \n",
       "Italy                    62,68     NaN      8,72      10,4  \n",
       "Jamaica                  73,77       2     20,82      6,52  \n",
       "Japan                    86,85       3      9,37      9,16  \n",
       "\n",
       "[62 rows x 16 columns]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc['China':'Japan', 'Region':'Deathrate']"
   ]
  },
  {
   "cell_type": "raw",
   "id": "14815b01-af62-45d5-a597-489fca13c054",
   "metadata": {},
   "source": [
    "使用read_csv获取 country 数据，然后拿到前10行的数据，只选取Country、Brithrate 和 Service，将其中的数据变成DataFrame，并使用to_csv函数将结果存到本地的 country.csv 文件中（注意不要存index col）。\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5fa7c034-b4b4-416b-a8f4-fc5b7d6bb8ea",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
